/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pe.gov.mtc.dgac.licencias.service;

import java.util.HashMap;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import pe.gov.mtc.dgac.licencias.bean.HorasTO;
import pe.gov.mtc.dgac.licencias.exception.BusinessException;
import pe.gov.mtc.dgac.licencias.persistence.HorasDAO;
import pe.gov.mtc.dgac.licencias.struts.Constants;

/**
 *
 * @author externo.gamaro
 */
public class HorasImplService implements HorasService{
   private HorasDAO dao;
   Log logger = LogFactory.getLog(this.getClass());
   public HorasImplService(HorasDAO dao){
     this.dao=dao;
   }

    public HashMap insertHoras(HorasTO hora) throws BusinessException {
        HashMap result=null;
        try{
             result=dao.insertHoras(hora);
        }catch(Exception e){
          logger.error(e);
	  throw new BusinessException(Constants.MESSAGE_ERROR_HORAS_UPDATE.getValue(),e);
        }
        
        return result;
    }

    public HashMap updateHoras(HorasTO hora) throws BusinessException {
        HashMap result=null;
        try{
             result=dao.updateHoras(hora);
        }catch(Exception e){
          logger.error(e);
	  throw new BusinessException(Constants.MESSAGE_ERROR_HORAS_UPDATE.getValue(),e);
        }
        
        return result;
    }

    public HashMap deleteHoras(HorasTO hora) throws BusinessException {
        HashMap result=null;
        try{
             result=dao.deleteHoras(hora);
        }catch(Exception e){
          logger.error(e);
	  throw new BusinessException(Constants.MESSAGE_ERROR_HORAS_UPDATE.getValue(),e);
        }
        
        return result;
    }

    public List<HorasTO> selectHoras(HorasTO hora) throws BusinessException {
       List<HorasTO> result=null;
        try{
             result=dao.selectHoras(hora);
        }catch(Exception e){
          logger.error(e);
	  throw new BusinessException(Constants.MESSAGE_ERROR_HORAS_CONSULTA.getValue(),e);
        }
        
        return result;
    }

}
